package com.msb.serviceerificationcode.controller;

import com.msb.internalcommon.response.NumberCodeResponse;
import com.msb.internalcommon.dto.ResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liukaihao
 * @date 2025/04/29
 */
@RestController
public class NumberCodeController {

    @GetMapping("/numberCode/{size}")
    public ResponseResult numberCode(@PathVariable("size") int size) {
       double  random = (Math.random()*9+1)*Math.pow(10,size-1);
       int result = (int)random;
       System.out.println("result generator send code :" + result);
        NumberCodeResponse response = new NumberCodeResponse();
        response.setNumberCode(result);
        return ResponseResult.success(response);
    }
}
